package messageLogger.deamon;

import messageLogger.helper.ClipboardHelper;

public class DeamonLogger extends Thread {

	private boolean Stop = false;
	private ClipboardHelper clipboardHelper;

	public DeamonLogger() throws Exception {
		clipboardHelper = new ClipboardHelper();
	}

	@Override
	synchronized public void run(){
		String message = null;
		while (!Stop) {
			message = clipboardHelper.getStringFromClipboard();
			System.out.println(message);
			try {
				this.wait(2000);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
	}

	public static void main(String[] args) throws Exception {
		(new DeamonLogger()).run();
	}
}
